﻿using RayDen.Library.Entity.Interface;

namespace RayDen.Library.Entity.Renderer
{

    public class QualitySettingsInfo : RendererSettingsBase, IRendererQualitySettings
    {

        public const string QSSamplesPerPixel = "QualitySettings.SamplesPerPixel";
        public const string QSShadowRaysPerLight = "QualitySettings.ShadowRaysPerLight";
        public const string QSLightSamplingStrategy = "QualitySettings.LightSamplingStrategy";
        public const string QSSuperSampling = "QualitySettings.SuperSampling";
        public const string QSTextureSampling = "QualitySettings.TextureSampling";



        public int SamplesPerPixel
        {
            get
            {
                return (int)this[QSSamplesPerPixel];
            }
            set
            {
                this[QSSamplesPerPixel] = value;
            }
        }

        public int ShadowRaysPerLight
        {
            get
            {
                return (int)this[QSShadowRaysPerLight];
            }
            set
            {
                this[QSShadowRaysPerLight] = value;
            }
        }

        public int SuperSamplingSize
        {
            get
            {
                return (int)this[QSSuperSampling];
            }
            set
            {
                this[QSSuperSampling] = value;
            }
        }

        public LightSamplingStrategy LightSamplingStrategy
        {
            get
            {
                return (LightSamplingStrategy)this[QSLightSamplingStrategy];
            }
            set
            {
                this[QSLightSamplingStrategy] = value;
            }
        }


        public TextureSamplingQuality TextureSamplingQuality
        {
            get
            {
                return (TextureSamplingQuality)this[QSTextureSampling];
            }
            set
            {
                this[QSTextureSampling] = value;
            }
        }

        public QualitySettingsInfo() { }

        public QualitySettingsInfo(IParameterBag cfg)
            : base(cfg)
        {
            this.SamplesPerPixel = cfg.Get(QSSamplesPerPixel, 128);
            this.ShadowRaysPerLight = cfg.Get(QSShadowRaysPerLight, 1);
            this.LightSamplingStrategy = cfg.Get(QSLightSamplingStrategy, LightSamplingStrategy.UniformOneLight);
            this.SuperSamplingSize = cfg.Get(QSSuperSampling, 1);
            this.TextureSamplingQuality = cfg.Get(QSTextureSampling, TextureSamplingQuality.Nearest);
        }
    }
}